Hello-world

Download and prepare

As a simple extension sample, you can download the extension that displays a message with a button on the ribbon at the following link:

Download link: hello-world.zip

Unzip the downloaded zip file and copy the hello-world folder containing the manifest.json file to the following folder under the extensions folder.

{user home path}\AppData\Local\DENSO CREATE\Next Design\extensions\

User home path example: C:\Users\user-name

To create this extension yourself, follow the steps below.

  • Create a hello-world folder directly under the extensions folder above.
  • Create an images folder in the hello-world folder and prepare About.png which will be the button image on the ribbon (32 x 32 images are recommended).
  • Create manifest.json and main.cs in the hello-world folder.

manifest.json

This manifest defines one button on the ribbon and one command to execute on the button.

{
  //extension definition
  "name": "HelloWorld",
  "version": "1.1.0",
  "publisher": "DENSO CREATE INC.",
  "license": "Next Design License Agreement. Copyright (C) 2019 DENSO CREATE INC. All rights reserved.",

  "main": "main.cs", //Specify a C# script as the entry point.
  "lifecycle": "application", //Specify the application lifecycle as the lifecycle.

  //extension point definition
  "extensionPoints": {
    //ribbon
    "ribbon": {
      "tabs": [
        //Define a ribbon tab to add for the extension.
        {
          "id": "HelloWorld.MainTab",
          "label": "Hello World",
          "orderBefore": "System.View",
          "groups": [
            //Define a group that separates the ribbon tabs.
            {
              "id": "HelloWorld.FirstGroup",
              "label": "Group 1",
              "controls": [
                //Define the Say Hello button
                {
                  "id": "HelloWorld.SayHelloButton",
                  "type": "Button",
                  "label": "Say Hello",
                  "imageLarge": "images/About.png",
                  "command": "Command.SayHello" //Specify the id of the command defined in the command below.
                }
              ]
            }
          ]
        }
      ]
    },

    //command
    "commands": [
      //Define a command that calls the command handler `SayHello`.
      {
        "id": "Command.SayHello",
        "execFunc": "SayHello" //Specify the public function implemented at the entry point.
      }
    ]
  }
}

main.cs

This C# script, specified as the entry point in the manifest, implements a simple command handler that displays a message.

//public function of command handler
public void SayHello(ICommandContext context,ICommandParams paramemters)
{
    App.Window.UI.ShowInformationDialog("Hello !", "Hello World");
}

Execute

When you launch Next Design, the ribbon looks like this:

Ribbon

Click the Say Hello button and the following message will be displayed.

Display message